home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / t_pent2.zip / PENT2.PAS < prev   
Pascal/Delphi Source File  |  1997-07-21  |  1KB  |  72 lines

  1. Uses
  2.   Opstring;
  3.  
  4. Const
  5.   searchstr = #$f7+#$d0+#$f7+#$d2+#$b9+#$37+#$00+#$f7+#$f1;
  6.   bufsize   = 32768;
  7. Var
  8.   Table     : BTable;
  9.   F         : File;
  10.   Buf       : Array[1..bufsize] of Char;
  11.   numread   : Word;
  12.   count     : Word;
  13.   Fixed     : Word;
  14. begin
  15.  
  16.   Writeln;
  17.   Writeln('Pentium 2 Delay Bug Fixer, (Borland: CRT unit, TurboPower: OPCRT, APTIMER)');
  18.   Writeln;
  19.  
  20.   If Paramcount=0 then
  21.   begin
  22.     Writeln('Syntax: Pent2 filename.exe');
  23.     Halt;
  24.   End;
  25.  
  26.   Assign(F,Paramstr(1));
  27.   {$I-} Reset(F,1); {$I+}
  28.   if IOresult<>0 then
  29.   begin
  30.     Writeln('File not found!: '+ParamStr(1));
  31.     halt;
  32.   End;
  33.  
  34.   Fixed:=0;
  35.   Bmmaketable(searchstr,table);
  36.  
  37.   Writeln('Searching...'#10);
  38.  
  39.   While Not eof(f) do
  40.   begin
  41.  
  42.     Blockread(f,Buf,bufsize,numread);
  43.     Count:=BMSearch(Buf,Numread,Table,SearchStr);
  44.  
  45.     If count<>$ffff then
  46.     Begin
  47.  
  48.       Inc(Fixed);
  49.       Writeln('Fixed at byte position: ',Filepos(F)-Numread+Count+5);
  50.  
  51.       Seek(F,Filepos(F)-Numread+Count+5);
  52.       Buf[1]:=#$7E;
  53.       BlockWrite(F,Buf,1);
  54.  
  55.     End;
  56.  
  57.     If Not Eof(f) Then Seek(F,Filepos(F)-length(Searchstr));
  58.  
  59.   end;
  60.  
  61.   Close(F);
  62.  
  63.   If Fixed=0 Then
  64.   Begin
  65.     Writeln('Bug not found:'#10);
  66.     Writeln(' 1. Not using bad Delay function!');
  67.     Writeln(' 2. Already patched');
  68.     Writeln(' 3. EXE compressed');
  69.   End;
  70.  
  71. End.
  72.